All-Pairs Common-Ancestor Problems in Weighted Dags
نویسندگان
چکیده
This work considers the (lowest) common ancestor problem in weighted directed acyclic graphs. The minimum-weight (lowest) common ancestor of two vertices is the vertex among the set of (lowest) common ancestors with the smallest ancestral distance. For the all-pairs minimum-weight common ancestor problem we present an O(nm) algorithm for arbitrary edge weights which is optimal for sparse graphs and an O(n2.575) algorithm for dense graphs with moderately bounded edge weights based on matrix multiplication. The presented solutions to the all-pairs minimum-weight lowest common ancestor problem are based upon solutions of the all-pairs all lowest common ancestors problem in unweighted graphs, which represents an upper bound. For the all-pairs all lowest common ancestors problem we give an O(nmk2) algorithm, with k the bound on the maximum number of lowest common ancestors for pairs, and an O(nmwidth(G)) algorithm, where width(G) is the size of the largest antichain (independent set) in the transitive closure of G. The ideas are applicable for fast matrix multiplication implying an O(n3.616) algorithm.
منابع مشابه
Computing Lowest Common Ancestors in Directed Acyclic Graphs
Finding the lowest common ancestor of a given pair of nodes is a fundamental algorithmic problem. In this paper we study the lowest common ancestor(LCA) problem on directed acyclic graphs (DAGs). A lowest common ancestor of two nodes a and b is a node c which is a common ancestor of a and b and no other node is both a common ancestor of a and b and a proper descendant of c. LCA on trees have be...
متن کاملFast Lowest Common Ancestor Computations in Dags
This work studies lowest common ancestor problems in directed acyclic graphs. We present fast algorithms for solving the All-Pairs Representative LCA and AllPairs All LCA problems with expected running time of O(n2 log n) and O(n3 log log n) respectively. The speed-ups over recently developed methods are achieved by applying transitive reduction on the input dags. The algorithms are experimenta...
متن کاملImproved Algorithms for the All-pairs Lowest Common Ancestor Problem in Directed Acyclic Graphs
We present a new algorithm for solving the all-pairs lowest common ancestor problem in directed acyclic graphs (dags). Our algorithm runs in time O(n), where λ satisfies the equation ω(1, λ, 1) = 1 + 2λ and ω(1, λ, 1) is the exponent of the multiplication of an n × n matrix by an n × n matrix. By the currently best bounds on ω(1, λ, 1), the running time of our algorithm is O(n). Our algorithm i...
متن کاملLowest Common Ancestors in Trees and Directed Acyclic Graphs1
We study the problem of finding lowest common ancestors (LCA) in trees and directed acyclic graphs (DAGs). Specifically, we extend the LCA problem to DAGs and study the LCA variants that arise in this general setting. We begin with a clear exposition of Berkman and Vishkin’s simple optimal algorithm for LCA in trees. The ideas presented are not novel theoretical contributions, but they lay the ...
متن کاملFaster algorithms for finding lowest common ancestors in directed acyclic graphs
We present two new methods for finding a lowest common ancestor (LCA) for each pair of vertices of a directed acyclic graph (dag) on n vertices and m edges. The first method is surprisingly natural and solves the all-pairs LCA problem for the input dag on n vertices and m edges in time O(nm). The second method relies on a novel reduction of the all-pairs LCA problem to the problem of finding ma...
متن کامل